home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-16 | 3.9 KB | 245 lines | [TEXT/MSWD] |
- {Global Variables}
- var
- left,top,width,height,HeightOne:integer;
-
-
- procedure ImportTemperatureData;
- var
- nDays,SamplesPerDay,hScale,vScale,width,height:integer;
- begin
- hScale:=2;
- vScale:=10;
- SetImport('Text');
- SetImportMinMax(34,40);
- Import(''); {Prompt for file name}
- GetPicSize(nDays,SamplesPerDay);
- SelectAll;
- Copy;
- Dispose(nPics);
- width:=SamplesPerDay*hScale;
- height:=nDays*vScale;
- SetNewSize(width+80,height+40);
- if DoublePlot then SetNewSize(width*2+80,height+40);
- SetBackgroundColor(0);
- MakeNewWindow('Temperature Data');
- Paste;
- RestoreRoi;
- RotateLeft;
- FlipVertical;
- ScaleSelection(hScale,vScale);
- RestoreRoi;
- Copy;
- Clear;
- MakeRoi(20,20,width,height);
- Paste;
- if DoublePlot then begin
- MakeRoi(20+width,20-vscale,width,height);
- Paste;
- end;
- KillRoi;
- end;
-
-
- macro 'Import Temperature Data';
- var
- DoublePlot:boolean;
- begin
- DoublePlot:=false;
- ImportTemperatureData;
- end;
-
-
- macro 'Import Temperature - Data Double Plot';
- var
- DoublePlot:boolean;
- begin
- DoublePlot:=true;
- ImportTemperatureData;
- end;
-
-
- procedure ImportSleepData;
- var
- nDays,SamplesPerDay,hScale,vScale,width,height:integer;
- x,y,RoiWidth,RoiHeight,vloc:integer;
- begin
- if DoublePlot then begin
- hScale:=0.125;
- vloc:=20
- end else begin
- hScale:=0.25;
- vloc:=10
- end;
- vScale:=10;
- SetImport('Text');
- SetImportMinMax(-4,8);
- Import(''); {Prompt for file name}
- GetPicSize(nDays,SamplesPerDay);
- SelectAll;
- ScaleSelection(1,hscale);
- RestoreRoi;
- Copy;
- Dispose(nPics);
- width:=SamplesPerDay*hScale;
- if DoublePlot then width:=width*2;
- height:=nDays*vScale;
- if width>height
- then height:=width;
- SetNewSize(width+80,height+40);
- SetBackgroundColor(0);
- MakeNewWindow('Sleep Data');
- Paste;
- RestoreRoi;
- SetOption; RotateLeft; {Erase before rotating}
- FlipVertical;
- ScaleSelection(1,vScale);
- RestoreRoi;
- GetRoi(x,y,RoiWidth,RoiHeight);
- Copy;
- Clear;
- MakeRoi(10,vloc,RoiWidth,RoiHeight);
- Paste;
- if DoublePlot then begin
- MakeRoi(10+RoiWidth,vloc-vscale,RoiWidth,RoiHeight);
- Paste;
- end;
- KillRoi;
- end;
-
-
- macro 'Import Sleep Data';
- var
- DoublePlot:boolean;
- begin
- DoublePlot:=false;
- ImportSleepData;
- end;
-
-
- macro 'Import Sleep Data - Double Plot';
- var
- DoublePlot:boolean;
- begin
- DoublePlot:=true;
- ImportSleepData;
- end;
-
-
- macro 'Draw Sleep Scale';
- var
- width,height,hloc,vloc,vdelta:integer;
- PicWidth,PicHeight:integer;
- begin
- SetFont('Helvetica');
- SetFontSize(9);
- SetText('Plain; Center; no background');
- SetLineWidth(1);
- width:=28;
- height:=28;
- GetPicSize(PicWidth,PicHeight);
- hloc:=PicWidth-width-10;
- vloc:=15;
- vdelta:=height-1;
- DrawBox(1,-4);
- DrawBox(22,-3);
- DrawBox(43,-2);
- DrawBox(75,-1);
- DrawBox(85,0);
- DrawBox(87,.1);
- DrawBox(96,.5);
- DrawBox(106,1);
- DrawBox(128,2);
- DrawBox(149,3);
- DrawBox(170,4);
- DrawBox(191,5);
- DrawBox(212,6);
- DrawBox(233,7);
- DrawBox(248,8);
- end;
-
- macro '(-'; begin end;
-
-
- macro '(....Edit Sleep Data....'; begin end;
-
-
- procedure Setup;
- begin
- MakeRoi(left,top,width,height);
- Copy;
- Paste;
- end;
-
- macro 'Top [T]'
- var
- PicWidth,PicHeight:integer;
- begin
- GetPicSize(PicWidth,PicHeight);
- left:=5;
- top:=10;
- width:=PicWidth-left-20;;
- HeightOne:=10;
- Height:=HeightOne;
- SetUp;
- end;
-
- macro 'Move Down [D]'
- begin
- Top:=top+10;
- SetUp;
- end;
-
- macro 'Move Up [U]'
- begin
- Top:=top-10;
- SetUp;
- end;
-
- macro 'One [1]';
- begin
- height:=HeightOne;
- SetUp;
- end;
-
- macro 'Two [2]';
- begin
- height:=2*HeightOne;
- SetUp;
- end;
-
- macro 'Three [3]';
- begin
- height:=3*HeightOne;
- SetUp;
- end;
-
- macro 'Four [4]';
- begin
- height:=4*HeightOne;
- SetUp;
- end;
-
- macro 'Five [5]';
- begin
- height:=5*HeightOne;
- SetUp;
- end;
-
- macro 'Six [6]';
- begin
- height:=6*HeightOne;
- SetUp;
- end;
-
- procedure DrawBox(BoxColor:integer; BoxLabel:real);
- begin
- MakeRoi(hloc,vloc,width,height);
- SetForeground(BoxColor);
- Fill;
- SetForeground(255);
- DrawBoundary;
- MoveTo(hloc+11,vloc+11);
- Writeln(BoxLabel);
- vloc:=vloc+vdelta;
- end;
-